import axios from 'axios'
import ElementUI from 'element-ui'

//本地测试
// axios.defaults.baseURL="http://localhost:8080"
//上线
axios.defaults.baseURL="http://112.124.18.46:8080"

// axios.defaults.baseURL="http://39.103.136.141:8080"

//前置拦截
axios.interceptors.request.use(config => {
        return config
    }
)
//后置拦截
axios.interceptors.response.use(response =>{
        // console.log(response)
        if (response.status === 200){
            return response
        }else{
            ElementUI.Notification.info({title: '后台出现错误！', message: '请查看后端日志信息', duration: 2500})
            return Promise.reject(response.data.message)
        }
    }
)
